package com.jfsnpm.action;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.jfsnpm.common.AppSql;

public class PmOrg {
	/**
	 * 获取所有组织架构
	 * @return
	 */
	public static List<Record> getAllOrg(){
		return Db.find(AppSql.getsql("pm.PmOrgSelect"));
	}
	/**
	 * 删除组织架构
	 * @param ids
	 * @return
	 */
	public static boolean deleteOrgs(String[] ids){
		for(String deleteorgid:ids){
			if(!Db.deleteById("pm_org", deleteorgid)) return false;
		}
		return true;
	}
	
	
	public static List<Record> getAllOrgWithAuth(String roleid){
		return Db.find(AppSql.getsql("pm.PmRelationRoleOrgWithAuth"),roleid);
	}
	
	public static List<Record> getAllOrgDept(){
		return Db.find(AppSql.getsql("pm.PmgetAllOrgDept"));
	}
}
